﻿@using WebStore.Domain.Entities.Enum
@model WebStore.Web.App.Models.Product.ProductModel
<div class="item">


    <h3>@Model.Name</h3>
    @if (Model.HasPhoto)
    {
        <img src="@Url.Action("ProductPhoto", "Product", new { id = Model.Id })" class="product-photo"/>
        <br/>
    }
    @Model.Description
    <h4>@Model.Price.ToString("c")</h4>



    @using (Html.BeginForm("Add", "Cart"))
    {
        @Html.HiddenFor(x => x.Id)
        @Html.Hidden("returnUrl", Request.Url.PathAndQuery)<br />
        <input type="submit" value="+ Add to cart" />
    }

    @if (ViewBag.IsInRole(RoleType.Administrator))
    {
        <p class="actionButtons">
            @Html.ActionLink("Edit", "EditProduct", "Admin", new { id = Model.Id }, null)
            @Html.ActionLink("Delete", "DeleteProduct", "Admin", new { id = Model.Id }, null)
        </p>
    }
</div>
